﻿using System.Collections.ObjectModel;

namespace Jacobi.Seesmic.FeedReader.Model
{
    /// <summary>
    /// Manages a collection of <see cref="FeedManager"/> items.
    /// </summary>
    internal sealed class FeedManagerCollection : KeyedCollection<string, FeedManager>
    {
        /// <summary>
        /// Returns the feed url as key.
        /// </summary>
        /// <param name="item">The item in the collection.</param>
        /// <returns>Returns null when <paramref name="item"/> is null.</returns>
        protected override string GetKeyForItem(FeedManager item)
        {
            if (item != null)
            {
                return item.FeedInfo.Url;
            }

            return null;
        }
    }
}